package com.song.log_stack.rest;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.song.log_stack.service.EasyServiceImpl;
import com.song.log_stack.vo.EasyVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * @author song
 * @Desc todo:
 * @date 2022/2/28
 */

@Slf4j
@RestController
@RequestMapping("/easy")
public class EasyRest {

    private final EasyServiceImpl easyService;

    public EasyRest(EasyServiceImpl easyService) {
        this.easyService = easyService;
    }

    /**
     * <h2>创建</h2>
     * */
    @PostMapping("/create")
    public Long create(@RequestBody EasyVo easyVo) throws JsonProcessingException {
        return easyService.create(easyVo);
    }

    /**
     * <h2>查看</h2>
     * */
    @GetMapping("/info")
    public List<EasyVo> info() throws IOException {
        return easyService.info();
    }

    /**
     * <h2>审核 的头像是否符合要求</h2>
     * 通过线程堆栈去分析
     * */
    @GetMapping("/audit")
    public Callable<Integer> audit() throws IOException {
        return easyService.callableAudit();
    }

}

